import React, { useState, useEffect } from 'react';
import ConfigTable from '../../../../components/configTable';

const ConstantParam = (props) => {
  const { value } = props;
  const [data, setData] = useState([]);

  useEffect(() => {
    value.tparams && setData(value.tparams);
  }, [value.tparams]);

  const cusColumns = [
    {
      title: '数据源参数名',
      dataIndex: 'name',
    },
    {
      title: '数据源参数位置',
      dataIndex: 'positionLabel',
    },
    {
      title: '类型',
      dataIndex: 'typeLabel',
    },
    {
      title: '参数值',
      dataIndex: 'val',
      render: (text) => text.split('').map(() => '*'),
    },
  ];

  return <ConfigTable data={data} cusColumns={cusColumns} isAdd={false} isDelete={false} />;
};
export default ConstantParam;
